package util.date;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;

public class DateTimeUtil {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        Callable<Date> task = new Callable<Date>() {

            @Override
            public Date call() throws Exception {
                return sdf.parse("20170621");
            }

        };
        ExecutorService threadPool = Executors.newFixedThreadPool(10);
        List<Future<Date>> resultList = new ArrayList<Future<Date>>();

        for (int x = 0; x < 12; x++){
            resultList.add(threadPool.submit(task));
        }

        for (Future<Date> future : resultList){
            System.out.println(future.get());
        }
        threadPool.shutdown();
    }

}
